package hos.net.soap.convert

import hos.net.soap.SoapConvertUtils
import hos.net.soap.exception.ListMapParseException
import org.json.JSONException
import java.lang.reflect.Type

/**
 * <p>Title: ListMapConvert </p>
 * <p>Description:  </p>
 * <p>Company: www.mapuni.com </p>
 *
 * @author : 蔡俊峰
 * @date : 2024-04-09 20:26
 * @version : 1.0
 */
class JsonDataListMapConvert : JsonDataConvert() {


    @Suppress("UNCHECKED_CAST")
    override fun <R> String.parseData(succeed: Type): R? {
        try {
            return SoapConvertUtils.parse(this) as R?
        } catch (e: JSONException) {
            throw ListMapParseException(message = "Map List Convert error", cause = e)
        }
    }
}